﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Xml;
using System.Data;

using BLL;
using DAL;
using Models;
using Web.Old_App_Code;
using System.Collections;

public partial class cn_UserControl_top_ad : System.Web.UI.UserControl
{
    // Fields
    protected string xmlPagePath = "/cn/xml/page.xml";

    // Methods
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected StringBuilder TopAdBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            XmlDocument document = new XmlDocument();
            document.Load(this.Page.Server.MapPath(this.xmlPagePath));
            XmlElement element = (XmlElement)document.SelectSingleNode("page_ad/top");
            builder.AppendLine("<div class=\"container\">");
            builder.AppendLine("<a href=\"" + element.GetAttribute("url") + "\">");
            builder.AppendLine("<img src=\"" + element.GetAttribute("src") + "\" alt=\"" + element.GetAttribute("alt") + "\" />");
            builder.AppendLine("</a>");
            builder.AppendLine("</div>");
        }
        catch
        {
        }
        return builder;
    }

}